<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<script type="text/javascript">
		window.onload = function(){
			var oBtn = document.getElementById('btn01');
			var oDiv = document.getElementById('div1');

			//oDiv.style.display 读取的是标签上写的属性值 
			//alert(oDiv.style.display);
			oBtn.onclick = function(){
				/*oDiv.style.display = 'none';*/

				//alert(oDiv.style.display);

				if(oDiv.style.display == 'block'||oDiv.style.display == ''){
					oDiv.style.display = 'none';
				}else{
					oDiv.style.display = 'block';
				}




			}


		}

	</script>
	<style type="text/css">
		.box{
			width: 200px;
			height: 400px;
			background-color: gold;
		}

	</style>
	<title>Document</title>
</head>
<body>
	<input type="button" name="" id="btn01" value="切换">
	<div class="box" id="div1"></div>
	
</body>
</html>